<template>
    <div class="user-detail-echarts">
        <chart :options="option" v-if="num"></chart>
    </div>
</template>

<script>
    export default {
        data () {
            return {
                num: false,
                option: {
                    xAxis: {
                        type: 'category',
                        data: []
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: {
                        type: 'bar',
                        barWidth: '40%',
                        data: []
                    }
                }
            }
        },
        methods: {
            getData (tabData) {
                this.option.xAxis.data = []
                this.option.series.data = []
                for (let i = 0; i < tabData.length; i++) {
                    this.option.xAxis.data.push(tabData[i].EVENT_DATETIME)
                    this.option.series.data.push(tabData[i].EVENT_COUNT)
                }
            }
        },
        mounted () {
            this.$nextTick(() => {
                this.num = true
            })
        }
    }
</script>

<style lang="stylus" rel="stylesheet/stylus">
    .user-detail-echarts
        width 100%
        height 200px
        .echarts
            width 100%
            height 100%
            & > div
                width 100% !important
                height 100% !important
                canvas
                    width 100% !important
                    height 100% !important
</style>
